Skip to content

Polylines

Polylines are made of vertices (points in 3D space) and edges linking them. They allow to embed a graph in \(\mathbb{R}^3\) and visualize it.

Edges are stored in a specific data container called edges as ordered pairs of vertex indices. They are not oriented and the smallest vertex index is always first. For example, \((1,3)\) is a valid edge index but \((3,1)\) is not. Edge orientation is performed automatically when instancing a Polyline from a RawMeshData (see Edition and Manual Creation)

Polyline Example

Example of a polyline

Polyline

Bases: Mesh

A data structure for representing polylines.

Attributes:

Name Type Description
vertices DataContainer

the container for all vertices

edges DataContainer

the container for all edges

__str__

Representation of the object and its elements as a string.

id_edges property

Shortcut for range(len(self.edges))

id_vertices property

Shortcut for range(len(self.vertices))

Polyline Connectivity

Connectivity handler class. Allows connectivity queries on the object, like neighbours of a vertex, etc.

Connectivity is computed lazily only when needed in the code. For instance, the first call to mesh.connectivity.vertex_to_vertices will generate the vertex_to_vertices dictionnary, so that the next call will not perform any computation but a lookup in the array.

clear()

Resets connectivity. The next query in the code will regenerate internal arrays.

edge_id(V1, V2)

id of an edge. If self.edges[i] contains edges (A,B), then edge_id(A,B)=edge_id(B,A)=i If (A,B) is not a valid edge of the mesh, returns None

Parameters:

Name Type Description Default
V1 int

first vertex of the edge

required
V2 int

second vertex of the edge

required

Returns:

Name Type Description
int int

the id of edge (V1,V2), or None if the edge does not exist.

edge_to_vertices(E)

Returns the two vertex indices that are adjacent to edge `E

Parameters:

Name Type Description Default
E int

edge index

required

Returns:

Name Type Description
list list

two vertex indices

other_edge_end(E, V)

Vertex at the opposite end of edge E from vertex V. Returns None if V is not adjacent to edge E

Parameters:

Name Type Description Default
E int

edge id

required
V int

vertex id

required

Returns:

Name Type Description
int int

the vertex W such that E is the edge (V,W). Returns None if V is not adjacent to edge E

vertex_to_edges(V)

Neighborhood of vertex V in terms of edges.

Parameters:

Name Type Description Default
V int

vertex id

required

Returns:

Name Type Description
list list

list of edges E such that V belongs to E.

vertex_to_vertices(V)

Neighborhood of vertex V in terms of vertices.

Parameters:

Name Type Description Default
V int

vertex id

required

Returns:

Name Type Description
list list

list of vertices W such that (V,W) is a valid edge in the polyline.